package com.bwei.like.mynewstop.activity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.bwei.like.mynewstop.R;

<<<<<<< 77331352d74e6afdfbbeaccca4370d33ffbea935
public class SMSRegistActivity extends AppCompatActivity implements View.OnClickListener {
=======
public class SMSRegistActivity extends BaseActivity implements View.OnClickListener {
>>>>>>> NewsTop

    private ImageView back_image;
    private EditText et_Phone_number;
    private EditText et_possword;
    private TextView regist;
    private TextView memory_Pwd;
    private Button loginButton;

    @Override
<<<<<<< 77331352d74e6afdfbbeaccca4370d33ffbea935
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
=======
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
>>>>>>> NewsTop
        setContentView(R.layout.activity_cell_regist);
        initView();

    }

    private void initView() {
        back_image = (ImageView) findViewById(R.id.back_image);
        back_image.setOnClickListener(this);
        et_Phone_number = (EditText) findViewById(R.id.ed_phnoe_number);
        et_possword = (EditText) findViewById(R.id.ed_password);
        regist = (TextView) findViewById(R.id.regist);
        regist.setOnClickListener(this);

        memory_Pwd = (TextView) findViewById(R.id.memoryPwd);
        memory_Pwd.setOnClickListener(this);

        loginButton = (Button) findViewById(R.id.login_Button);
        loginButton.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            //注册
            case R.id.regist:
                //跳转activity
                startActivity(new Intent(SMSRegistActivity.this, RegistActivity.class));
                overridePendingTransition(R.anim.cell_regeist_in, R.anim.phone_out);
                break;

            //忘记密码
            case R.id.memoryPwd:

                break;

            //登陆按钮
            case R.id.login_Button:
                String phone_number = et_Phone_number.getText().toString();
                String possword = et_possword.getText().toString().trim();
                if (TextUtils.isEmpty(phone_number)){
                    Toast.makeText(SMSRegistActivity.this, "手机号不能为空！", Toast.LENGTH_SHORT).show();
                }else if (TextUtils.isEmpty(possword)){
                    Toast.makeText(SMSRegistActivity.this, "密码不能为空！", Toast.LENGTH_SHORT).show();
                }else if (phone_number.length()<11){
                    Toast.makeText(SMSRegistActivity.this, "请输入正确的手机号！", Toast.LENGTH_SHORT).show();
                }
                break;

            //图标返回键
            case R.id.back_image:
                finish();
                overridePendingTransition(R.anim.phone_in,R.anim.cell_regeist_out);
                break;
        }
    }
}


//    RegisterPage registerPage = new RegisterPage();
//registerPage.setRegisterCallback(new EventHandler() {
//public void afterEvent(int event, int result, Object data) {
//// 解析注册结果
//        if (result == SMSSDK.RESULT_COMPLETE) {
//@SuppressWarnings("unchecked")
//HashMap<String,Object> phoneMap = (HashMap<String, Object>) data;
//        String country = (String) phoneMap.get("country");
//        String phone = (String) phoneMap.get("phone");
//
//// 提交用户信息（此方法可以不调用）
//        //  registerUser(country, phone);
//        }
//        }
//        });
//        registerPage.show(this);
//        finish();